package com.chexiehui.jc.utils;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class HtmlFormat {
    public static String getNewContent(String htmltext) {
        Document doc = Jsoup.parse(htmltext);
        Elements elements = doc.getElementsByTag("img");
        for (Element element : elements) {
            element.attr("width", "100%").attr("height", "auto");
        }
        return doc.toString()
                .replace("<html>", "")
                .replace("<head>", "")
                .replace("</head>", "")
                .replace("<body>", "")
                .replace("</body>", "")
                .replace("</html>", "");
    }
}
